package dk.fuddi.grails

/**
 * @author fuddi
 */

class GVector extends Vector {
  public void apply(c) {
    for (i in 0..<size()) {
      this[i] = c(this[i])
    }
  }
}

def vector = new GVector()
vector.add(2)
vector.add(3)
vector.add(4)

def c = {
  numberToSquare -> numberToSquare * numberToSquare
}

vector.apply(c)

def c2 = {
  value -> println(value)
}
vector.apply(c2)